package com.ethank.enums.ali;

import com.ethank.entity.VoucherResponseVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * 通用机打发票
 */

public enum CommonPrintedInvoiceEnum {
    TITLE("title", "标题", "", 1, false),
    FORMTYPE("formType", "发票联次", "", 1, false),
    INVOICECODE("invoiceCode", "发票代码", "", 1, true),
    INVOICENUMBER("invoiceNumber", "发票号码", "", 1, true),
    PRINTEDINVOICECODE("printedInvoiceCode", "发票代码-机打", "", 1, true),
    PRINTEDINVOICENUMBER("printedInvoiceNumber", "发票号码-机打", "", 1, true),
    INVOICEDATE("invoiceDate", "开票日期", "", 2, false),
    TOTALAMOUNT("totalAmount", "合计金额", "", 1, true),
    SELLERNAME("sellerName", "销售方名称", "", 1, false),
    SELLERTAXNUMBER("sellerTaxNumber", "销售方纳税人识别号", "", 1, false),
    PURCHASERNAME("purchaserName", "购买方名称", "", 1, false),
    PURCHASERTAXNUMBER("purchaserTaxNumber", "购买方纳税人识别号", "", 1, false),
    DRAWER("drawer", "开票人", "", 1, false),
    RECIPIENT("recipient", "收款人", "", 1, false),
    REMARKS("remarks", "备注", "", 1, false),
    INVOICEDETAILS("invoiceDetails", "发票详单", "", 1, false),
    ITEMNAME("itemName", "项目名称", "", 1, false),
    UNIT("unit", "单位", "", 1, false),
    QUANTITY("quantity", "数量", "", 1, false),
    UNITPRICE("unitPrice", "单价", "", 1, false),
    AMOUNT("amount", "总值", "", 1, false);


    private String key;
    private String label;
    private String value;
    private Integer type;
    private boolean require;


    CommonPrintedInvoiceEnum() {
    }

    CommonPrintedInvoiceEnum(String key, String label, String value, Integer type, boolean require) {
        this.key = key;
        this.label = label;
        this.value = value;
        this.type = type;
        this.require = require;
    }

    public static List<VoucherResponseVO> convertVoucher() {
        ArrayList<VoucherResponseVO> vos = new ArrayList<>();
        for (CommonPrintedInvoiceEnum fieldEnum : CommonPrintedInvoiceEnum.values()) {
            VoucherResponseVO vo = new VoucherResponseVO();
            vo.setKey(fieldEnum.getKey());
            vo.setLabel(fieldEnum.getLabel());
            vo.setType(fieldEnum.getType());
            vos.add(vo);
        }
        return vos;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public boolean isRequire() {
        return require;
    }

    public void setRequire(boolean require) {
        this.require = require;
    }
}
